package vo;

import java.io.Serializable;

import po.BookPO;
import po.SaleItemPO;

public class SaleItemVO implements Serializable {
	
	private static final long serialVersionUID = -4134334844190422626L;
	
	private BookPO bookPO;
	
	private int quantity;
	
	public SaleItemVO() {
		super();
	}
	
	public SaleItemVO(SaleItemPO saleItemPO) {
		this.bookPO = new BookPO();
		this.bookPO.setId(saleItemPO.getBookID());
		this.quantity = saleItemPO.getQuantity();
	}

	public SaleItemVO(BookPO bookPO, int quantity) {
		super();
		this.bookPO = bookPO;
		this.quantity = quantity;
	}
	
	public SaleItemVO(BookVO bookVO, int quantity) {
		super();
		this.bookPO = bookVO.getBookPO();
		this.quantity = quantity;
	}

	public BookVO getBookVO() {
		return new BookVO(bookPO);
	}
	
	public int getQuantity() {
		return this.quantity;
	}
	
	public SaleItemPO getSaleItemPO() {
		return new SaleItemPO(bookPO.getId(), quantity);
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	@Override
	public String toString() {
		return "SaleItemVO [bookPO=" + bookPO + ", quantity=" + quantity + "]";
	}

}
